import turtle
def drawBer(t,height):
    """ Get turtle t to draw one ber,of height"""
    
    
    t.begin_fill()
    t.left(90)
    t.forward(height)
    t.write(str(height))
    t.right(90)
    t.forward(40)
    t.right(90)
    t.forward(height)
    t.left(90)
    t.end_fill()

xs = [28,100,200,240,160,360,220]
maxheight = max(xs)
numbars = len(xs)
border = 10
wn = turtle.Screen()
wn.setworldcoordinates(0-border, 0-border, 40*numbars+border, maxheight+border)
wn.bgcolor("lightyellow")

tess = turtle.Turtle()
tess.color("blue")
tess.fillcolor("red")
tess.pensize(3)

for a in xs:
    drawBer(tess, a)

wn.exitonclick()